import wx
import wx.xrc

from app.util.controls import vncPanel

class XrcHandler(wx.xrc.XmlResourceHandler):

    extra_styles = [
    ]

    def __init__(self):
        wx.xrc.XmlResourceHandler.__init__(self)
        self.AddWindowStyles()
        for style in self.extra_styles:
            self.AddStyle("wx%s" % style, getattr(wx, style))

    def CanHandle(self,node):
        return self.IsOfClass(node, 'vncPanel')

    def DoCreateResource(self):
        assert self.GetInstance() is None
        _res = vncPanel.RfbPanel(
            self.GetParentAsWindow(),
            self.GetID(),
            pos=self.GetPosition(),
            size=self.GetSize(),
        )
        self.SetupWindow(_res)
        return _res

# vim: set sts=4 sw=4 et :
